<template>
  <div class="notice-container">
     <!--面包导航区域  -->
    <breadcrumb></breadcrumb>

    <!-- 卡片 -->
    <el-card>
      <!-- 标题 -->
      <div slot="header" class="clearfix" > 
        <p>报名内容管理</p>

      </div>
      <!-- 公告表格 -->
      <el-table :data="noticeInfo" border stripe>
        <el-table-column type="index" label="ID"></el-table-column>
        <el-table-column label="报名人信息" prop="name"></el-table-column>
        <el-table-column label="手机号" prop="phone"></el-table-column>
        <el-table-column label="邮箱" prop="email"></el-table-column>
        <el-table-column label="发布时间" prop="pubdate"></el-table-column>
      </el-table>

      <!-- 分页区域 -->
      <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="noticeParams.pagenum"
      :page-sizes="[2, 5, 10]"
      :page-size="noticeParams.per_page"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total_count">
    </el-pagination>
    </el-card>


  </div>
</template>

<script>
import Breadcrumb from "@/components/Breadcrumb.vue";
import {getJoin} from '@/api/join.js'
export default {
  components: {
    Breadcrumb,
  },
  data(){
    return{
      //公告参数
      noticeParams:{
        pagenum:1,
        per_page:5,
      },
      //文章总页数
      total_count:null,
      //公告信息
      noticeInfo:[],

    }
  },
  created(){
    //加载公告数据
    this.loadNotice()
  },
  methods:{
    //加载公告数据
    async loadNotice(){
      const {data:res} = await getJoin(this.noticeParams)
      console.log(res)
      this.noticeInfo = res.data
      this.total_count = res.total_count
      console.log(res.total_count)
    },


     //监听papenum改变的事件
    handleCurrentChange(newPage) {
      this.noticeParams.pagenum = newPage;
      this.loadNotice();
    },
    //监听per_page改变的事件
    handleSizeChange(newSize) {
      this.noticeParams.per_page = newSize;
      this.loadNotice();
    },
  },
}
</script>

<style lang='less' scoped>
.notice-container{
  .clearfix{
    display: flex;
    justify-content: space-between;
    align-items: baseline
    

  }
}
</style>

